package com.ptswitch.material.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
public class Upload implements Serializable {

	private static final long serialVersionUID = 1601793802697969503L;
	@Id
	@GeneratedValue(generator = "hibernateuuid")
	@GenericGenerator(name = "hibernateuuid", strategy = "uuid")
	@Column(length = 32)
	private String id;

	@ManyToOne(fetch = FetchType.EAGER)
	@NotFound(action = NotFoundAction.IGNORE)
	private Uzer user;

	@Column(columnDefinition="varchar(32) default ''")
	private String ownerType;
	@Column(columnDefinition="varchar(32) ")
	private String ownerId;
	
	@Column(columnDefinition="varchar(2048) default ''")
	private String fileName;
	@Column(columnDefinition="varchar(2048) default ''")
	private String filePath;
	@Column(columnDefinition="varchar(2048) default ''")
	private String fileType;
	
	@Column(columnDefinition="varchar(32) default ''")
	private String createTime;
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getOwnerType() {
		return ownerType;
	}

	public void setOwnerType(String ownerType) {
		this.ownerType = ownerType;
	}

	public String getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getFilePath() {
		return filePath;
	}

	public void setFilePath(String filePath) {
		this.filePath = filePath;
	}

	public String getFileType() {
		return fileType;
	}

	public void setFileType(String fileType) {
		this.fileType = fileType;
	}

	public String getCreateTime() {
		return createTime;
	}

	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}

	public Uzer getUser() {
		return user;
	}

	public void setUser(Uzer user) {
		this.user = user;
	}

}
